﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:props="clr-namespace:ScrumFactory.Windows.Properties"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib">



    <Style TargetType="{x:Type Button}">
        <Setter Property="Background" Value="{StaticResource ButtonBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ButtonForegroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ButtonBorderBrush}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Margin" Value="3"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <!--<Setter Property="FontWeight" Value="Bold"/>-->
        <Setter Property="FontSize" Value="{StaticResource NormalFontSize}"/>
        
        <Setter Property="Template">
            <Setter.Value>                
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="border"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"                            
                            Cursor="Hand"
                            ToolTip="{TemplateBinding ToolTip}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="4"
                            Margin="{TemplateBinding Margin}"
                            CornerRadius="3" >
                        
                            <ContentPresenter                                                                
                            HorizontalAlignment="Center" VerticalAlignment="Center"                                
                            TextBlock.FontWeight="{TemplateBinding FontWeight}"                     
                            TextBlock.Foreground="{TemplateBinding Foreground}"                                    
                            TextBlock.FontSize="{TemplateBinding FontSize}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            Content="{TemplateBinding Content}" />
                        <Border.Effect>
                            <DropShadowEffect Opacity="0.3" ShadowDepth="2"/>
                        </Border.Effect>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="border" Property="Effect" Value="{x:Null}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>                
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="AlertButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="Background" Value="{StaticResource AlertButtonBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource AlertButtonForegroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AlertButtonBorderBrush}"/>
        <Setter Property="BorderThickness" Value="2"/>
    </Style>
    
    <Style x:Key="ActionButton" TargetType="{x:Type Button}">        
        <Setter Property="Cursor" Value="Hand"/>   
        <Setter Property="FontWeight" Value="Normal"/>           
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <ContentPresenter
                        Content="{TemplateBinding Content}"
                        HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                        VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Visibility" Value="Collapsed"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <Style x:Key="MinimizeButton" TargetType="{x:Type Button}">        
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Width="20" Height="12" Cursor="Hand" Background="Transparent">
                        <Rectangle x:Name="rectangle" 
                               Cursor="Hand"                               
                                   HorizontalAlignment="Right" 
                               Width="12" Height="8" StrokeThickness="1" >
                            <Rectangle.Fill>
                                <SolidColorBrush Color="{StaticResource Green2Color}"/>
                            </Rectangle.Fill>
                            <Rectangle.Stroke>
                                <SolidColorBrush Color="{StaticResource Green4Color}"/>
                            </Rectangle.Stroke>
                        </Rectangle>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="rectangle" Property="Margin" Value="0,1,0,0"/>
                            <Setter TargetName="rectangle" Property="Effect" Value="{x:Null}"/>                            
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="False">                            
                            <Setter TargetName="rectangle" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect ShadowDepth="1" Opacity="0.3"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="Command" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MaximizeButton" TargetType="{x:Type Button}">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Width="20" Height="12" Cursor="Hand" Background="Transparent">
                        <Rectangle x:Name="rectangle"
                               RadiusX="2" RadiusY="2"
                                   HorizontalAlignment="Right"
                               Cursor="Hand"
                               Width="12" Height="10" StrokeThickness="1" >
                            <Rectangle.Fill>
                                <SolidColorBrush Color="{StaticResource Green2Color}"/>
                            </Rectangle.Fill>
                            <Rectangle.Stroke>
                                <SolidColorBrush Color="{StaticResource Green4Color}"/>
                            </Rectangle.Stroke>
                        </Rectangle>
                    </Grid>
                    <ControlTemplate.Triggers>                        
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="rectangle" Property="Margin" Value="0,1,0,0"/>
                            <Setter TargetName="rectangle" Property="Effect" Value="{x:Null}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="False">
                            <Setter TargetName="rectangle" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect ShadowDepth="1" Opacity="0.3"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="Command" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CloseButton" TargetType="{x:Type Button}">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Background">
            <Setter.Value>
                <SolidColorBrush Color="{StaticResource Green2Color}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <SolidColorBrush Color="{StaticResource Green4Color}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Width="16" Height="12" Cursor="Hand" Background="Transparent">
                        <Polygon x:Name="cross"  StrokeThickness="1" 
                             HorizontalAlignment="Right" VerticalAlignment="Center"
                             Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}"
                             Points="0,0 3,0 5,2 7,0 10,0 8,4 10,8 7,8 5,6 3,8 0,8 2,4"/>                                                    
                    </Grid>
                    
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="cross" Property="Margin" Value="0,1,0,0"/>
                            <Setter TargetName="cross" Property="Effect" Value="{x:Null}"/>                            
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="False">
                            <Setter TargetName="cross" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect ShadowDepth="1" Opacity="0.3"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="Command" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    
    <Style x:Key="DetailButton" TargetType="{x:Type Button}">        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid  Width="16" Height="16" SnapsToDevicePixels="True" Cursor="Hand">
                        <Ellipse                        
                        x:Name="ellipse"
                        Width="16"
                        Height="16"
                        Stroke="LightGray" 
                        HorizontalAlignment="Center" VerticalAlignment="Center"   
                        Fill="Transparent"/>                        
                        <Path                              
                            x:Name="arrow"                                            
                            StrokeEndLineCap="Round"
                            StrokeStartLineCap="Round"                             
                            HorizontalAlignment="Center" VerticalAlignment="Center"   
                            Stroke="LightGray"
                            StrokeThickness="2"
                            Margin="3,0,0,0" 
                            Data="M 0 0 L 3 3 L 0 6"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="ellipse" Property="Fill" Value="{StaticResource MouseOverBackgroundBrush}"/>
                            <Setter TargetName="ellipse" Property="Stroke" Value="Gray"/>
                            <Setter TargetName="arrow" Property="Stroke" Value="Gray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="AddCircleButton" TargetType="{x:Type Button}">
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="32"/>
        <Setter Property="FontSize" Value="{StaticResource NormalFontSize}"/>
        <Setter Property="Foreground" Value="{StaticResource LinkBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Image Source="/Images/Toolbar/addCircle.png" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Stretch="Uniform"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CleanButton" TargetType="{x:Type Button}">
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>        
        <Setter Property="FontSize" Value="{StaticResource NormalFontSize}"/>
        <Setter Property="Foreground" Value="{StaticResource LinkBrush}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Background="{TemplateBinding Background}">
                        <ContentPresenter Content="{TemplateBinding Content}"/>
                    </Grid>                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

 

    <Style x:Key="MoveUpActionButton" BasedOn="{StaticResource ActionButton}" TargetType="{x:Type Button}">                
        <Setter Property="Template">            
            <Setter.Value>
                <ControlTemplate>
                    <Path Margin="2" Width="24" Height="24"
                    Fill="Gray" Stroke="Gray"
                    HorizontalAlignment="Center" VerticalAlignment="Center"
                    Data="M 0 6 L 12 6 L 6 0 Z" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>        
    </Style>

    <Style x:Key="MoveDownActionButton" BasedOn="{StaticResource ActionButton}" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Path 
                    Margin="2" Width="24" Height="24"
                    Fill="Gray" Stroke="Gray"
                    HorizontalAlignment="Center" VerticalAlignment="Center"
                    Data="M 0 0 L 12 0 L 6 6 Z" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="RemoveActionButton" BasedOn="{StaticResource ActionButton}"  TargetType="{x:Type Button}">    
        <Setter Property="ToolTip" Value="{x:Static props:Resources.Remove}"/>        
        <Setter Property="Template">
            <Setter.Value>        
                <ControlTemplate>
                    <Image 
                           HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                           VerticalAlignment="{TemplateBinding VerticalAlignment}"
                           Source="/Images/Buttons/Remove.png"
                           Width="24" Height="24"/>
                </ControlTemplate>                
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="MoveItemLeftButton" TargetType="{x:Type Button}">
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="32"/>                
        <Setter Property="Template">
            <Setter.Value>                
                <ControlTemplate TargetType="{x:Type Button}">
                    
                        <Path
                        x:Name="arrow"
                        Cursor="Hand" VerticalAlignment="Center" HorizontalAlignment="Right"
                        Fill="{StaticResource ScrollBarBrush}" Stroke="{StaticResource ScrollBarBorderBrush}" Opacity="0.8" 
                        Data="M 0 10 L 10 0 L 10 6 L 20 6 L 20 14 L 10 14 L 10 20 Z">                            
                            <Path.RenderTransform>                                
                                <ScaleTransform ScaleX="1.4" ScaleY="1.4" CenterX="20" />
                            </Path.RenderTransform>
                        </Path>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" Value="Hidden"/>
                        </Trigger>
                        <EventTrigger RoutedEvent="MouseEnter">
                            <EventTrigger.Actions>
                                <BeginStoryboard>
                                    <Storyboard AutoReverse="True" RepeatBehavior="Forever">
                                        <DoubleAnimation                                                                        
                                                Storyboard.TargetName="arrow" 
                                                Storyboard.TargetProperty="(Path.RenderTransform).(ScaleTransform.ScaleX)"                                               
                                                To="1.7"
                                                Duration="00:00:0.5"
                                                PresentationOptions:Freeze="True"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                        <EventTrigger RoutedEvent="MouseLeave">
                            <EventTrigger.Actions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation                                                                        
                                                Storyboard.TargetName="arrow"
                                                Storyboard.TargetProperty="(Path.RenderTransform).(ScaleTransform.ScaleX)"                                               
                                                To="1.4"
                                                Duration="00:00:0.5"
                                                PresentationOptions:Freeze="True"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MoveItemRightButton" TargetType="{x:Type Button}">
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="32"/>        
        <Setter Property="Foreground" Value="{StaticResource LinkBrush}"/>
        <Setter Property="Template">
            <Setter.Value>              
                <ControlTemplate TargetType="{x:Type Button}">
                    <Path
                        x:Name="arrow"
                        Cursor="Hand" VerticalAlignment="Center"
                        Fill="{StaticResource ScrollBarBrush}" Opacity="0.8" Stroke="{StaticResource ScrollBarBorderBrush}"
                        Data="M 0 6 L 10 6 L 10 0 L 20 10 L 10 20 L 10 14 L 0 14 Z">
                        <Path.RenderTransform>
                            <ScaleTransform x:Name="scale" ScaleX="1.4" ScaleY="1.4"/>
                        </Path.RenderTransform>
                    </Path>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" Value="Hidden"/>
                        </Trigger>                        
                        <EventTrigger RoutedEvent="MouseEnter">                            
                            <EventTrigger.Actions>
                                <BeginStoryboard>
                                    <Storyboard AutoReverse="True" RepeatBehavior="Forever">
                                        <DoubleAnimation                                                                        
                                                Storyboard.TargetName="arrow"
                                                Storyboard.TargetProperty="(Path.RenderTransform).(ScaleTransform.ScaleX)"                                               
                                                To="1.7"
                                                Duration="00:00:0.5"
                                                PresentationOptions:Freeze="True"/>                                  
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                        <EventTrigger RoutedEvent="MouseLeave">
                            <EventTrigger.Actions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation                                                                        
                                                Storyboard.TargetName="arrow"
                                                Storyboard.TargetProperty="(Path.RenderTransform).(ScaleTransform.ScaleX)"                                               
                                                To="1.4"
                                                Duration="00:00:0.5"
                                                PresentationOptions:Freeze="True"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CheckToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="32"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Image
                        x:Name="checkImage"
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        Source="/Images/Buttons/not_check.png" Stretch="Uniform"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="checkImage" Property="Source" Value="/Images/Buttons/check.png"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="checkImage" Property="Source" Value="/Images/Buttons/check.png"/>
                            <Setter TargetName="checkImage" Property="Opacity" Value="0.7"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CheckButton" TargetType="{x:Type Button}">
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="32"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Image
                        x:Name="checkImage"
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        Source="/Images/Buttons/not_check.png" Stretch="Uniform"/>
                    <ControlTemplate.Triggers>                        
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="checkImage" Property="Source" Value="/Images/Buttons/check.png"/>
                            <Setter TargetName="checkImage" Property="Opacity" Value="0.7"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CleanToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="Cursor" Value="Hand"/>        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="border" BorderBrush="Transparent" BorderThickness="1" CornerRadius="2">
                        <ContentPresenter Content="{TemplateBinding Content}"/>
                    </Border>                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="False">
                            <!--<Setter TargetName="border" Property="Border.BorderBrush" Value="{StaticResource SelectedItemBackgroundBrush}"/>-->
                            <Setter Property="Opacity" Value="0.5"/>
                        </Trigger>                        
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>





</ResourceDictionary>